import request from '@/utils/request'
import store from '@/store'
// 查询VipOrder列表
export function listVipOrder(query) {
    return request({
        url: '/api/v1/vipOrderList',
        method: 'get',
        params: query
    }).then(function (res) {
        
        
        let boolOptions = store.getters.parameter.sys_bool;
       
        res.data.list.forEach((item, index) => {
            
            for (let key in item) {
                
                 
                if (key == "isPaid") {
                    item[key] = getDictLabelByValue(item[key],boolOptions)
                }
               

            }
             
            res.data.list[index] = item
        });
        // console.log(res.data.list)
        return res;

    })
}
function getDictLabelByValue(value,dict_list){
    let dictLabel="";
    if(dict_list){
        dict_list.forEach((_item,index)=>{
            if(_item.dictValue==value){
                dictLabel= _item.dictLabel
            }
        })
        return dictLabel;
    }else{
        console.log(value);
        return ;
    }
    
}
// 查询VipOrder详细
export function getVipOrder(orderId) {
    return request({
        url: '/api/v1/vipOrder/' + orderId,
        method: 'get'
    })
}


// 新增VipOrder
export function addVipOrder(data) {
    return request({
        url: '/api/v1/vipOrder',
        method: 'post',
        data: data
    })
}

// 修改VipOrder
export function updateVipOrder(data) {
    return request({
        url: '/api/v1/vipOrder',
        method: 'put',
        data: data
    })
}

// 删除VipOrder
export function delVipOrder(orderId) {
    return request({
        url: '/api/v1/vipOrder/' + orderId,
        method: 'delete'
    })
}